<?php
/* SVN FILE: $Id: skill_categories_controller.php 250 2010-06-17 10:55:41Z gregory.rome $ */
/**
 * SkillCategories Controller.
 *
 * Skill categories are for internal usage only.
 *
 * cBBweb : Digital Blood Bowl league interface (http://code.google.com/p/cbbweb/)
 * Copyright 2009-2010, Grégory Romé.
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @filesource
 * @copyright     Copyright 2009-2010, Grégory Romé.
 * @link          http://code.google.com/p/cbbweb/ cBBweb Project
 * @package       cbbweb
 * @subpackage    cbbweb.controllers
 * @version       $Revision: 250 $
 * @modifiedby    $LastChangedBy: gregory.rome $
 * @lastmodified  $Date: 2010-06-17 10:55:41 +0000 (Thu, 17 Jun 2010) $
 * @license       http://www.opensource.org/licenses/mit-license.php The MIT License
 */

/**
 * SkillCategories Controller.
 *
 * @package       cbbweb
 * @subpackage    cbbweb.controllers
 */
class SkillCategoriesController extends AppController {

	var $name = 'SkillCategories';

	var $paginate = array (
	'SkillCategory' => array(
        'limit' => 32,
        'order' => array('SkillCategory.id' => 'asc'),
        'contain' => array('LocalizedString')),
	'Skill' => array(
	    'limit' => 32,
        'order' => array('SkillCategory.id' => 'asc'),
        'contain' => array(
            'LocalizedString',
            'FormattedString',
            'SkillCategory' => array ('LocalizedString')
	   ))
	);

	function index() {
        $this->set('skillCategories', $this->paginate());
	}

	function view($id = null) {
		if (!$id) {
			$this->Session->setFlash(__('Invalid SkillCategory.', true));
			$this->redirect(array('action'=>'index'));
		}

		$skillCategory = $this->SkillCategory->find('all', array(
          'conditions' => array('SkillCategory.id' => $id),
          'contain' => array('LocalizedString')
		 ) );

        $this->set('skillCategory', $skillCategory[0]);

        $skills= $this->paginate('Skill', array('SkillCategory.id' => $id));
        $this->set('skills', $skills);

	}

}
?>
